Test Series - java script

Test Number 69/92

Q: What type of scope is present in JavaScript?
A. Lexical
B. Literal
C. Both Lexical and Literal
D. Local
Solution: Lexical scoping (sometimes known as static scoping) is a convention used with many programming languages that sets the scope (range of functionality) of a variable so that it may only be called (referenced) from within the block of code in which it is defined.
Q: Which function is used to stop the time logging?
A. stopTimeLogging()
B. stop()
C. finish()
D. abort()
Solution: The function stopTimeLogging() is used to stop the time logging. The stopTimeLogging() stops the timing data for ad hoc, etc for referencing an uncached document.location.
Q: The lexical scooping in JavaScript is based on which of the following?
A. Segments
B. Blocks
C. Functions
D. Entire code
Solution: Lexical scoping (sometimes known as static scoping) is a convention used with many programming languages that sets the scope (range of functionality) of a variable so that it may only be called (referenced) from within the block of code in which it is defined. JavaScript has lexical scoping based on functions but not blocks.
Q: What is the return data type of the property accept that belongs to the Input element?
A. integer
B. string
C. boolean
D. float
Solution: The accept attribute is used to define the types of files that the control can select. When type is “file”, this property is a comma-separated list of MIME types that specify the types of files that may be selected. The strings “audio/*”, “video/*”, and “image/*” are also legal.
Q: What is the purpose of the property width belonging to the ImageData element?
A. Number of data
B. Number of pixels
C. Number of pixels per row of data
D. Number of columns
Solution: Image data element indicates the intrinsic width of the image, in CSS pixels. The width property is used to retrieve or store the number of pixels per row of data.
Q: What is the purpose of the adoptNode() method?
A. Removes node
B. Makes it ready for insertion
C. Removes node and Makes it ready for insertion
D. Changes the node
Solution: This method removes the node from whatever document it is currently part of and changes its ownerDocument property to this document, making it ready for insertion into this document. The adoptNode() method adopts a node from another document. The adopted node can be of all node types.
Q: What is the function of the method importNode()?
A. Copies without removing
B. Copies and removes
C. Only copies
D. Only removes
Solution: The importNode() method imports a node from another document. The imported node can be of all node types. The method importNode() copies a node from another document without removing it.
Q: How can you create a node for comment in JavaScript?
A. comment()
B. createComment()
C. comm()
D. create()
Solution: The comment node can be created using the method Comment createComment(string data). The createComment() method creates a Comment node with the specified text.
Q: How can you dispatch a synthetic event object?
A. dispatchEvent()
B. dispatch()
C. dispatch(Event)
D. eventdispatch()
Solution: When you have created and initialized a synthetic event object, you can dispatch it using the dispatchEvent() method of EventTarget. The dispatchEvent method throws UNSPECIFIED_EVENT_TYPE_ERR if the event’s type was not specified by initializing the event before the method was called, or if the event’s type is null or an empty string.
Q: How do you specifically execute a command in JavaScript?
A. execcommand()
B. exec(command)
C. execCommand()
D. exec(command id)
Solution: The command can be executed using boolean execCommand(string commandId, [boolean showUI, [string value]]). The execCommand() method executes the specified command for the selected part of an editable section.

You Have Score    /10